home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Topik / Topik - Disk 16 - KnowAboutIt (19xx)(Topik Public Domain)(PD)[WB].zip / Topik - Disk 16 - KnowAboutIt (19xx)(Topik Public Domain)(PD)[WB].adf / ExecLib / readme < prev    next >
Text File  |  1989-10-01  |  4KB  |  137 lines

  1.  
  2. *** TOPIK Note : This is one of those things that I mention a lot where if
  3. you know what you are doing in this area of programming, then you'll find
  4. what you need.  No need to list the contents.....its all here in this
  5. directory waiting to be found.
  6.  
  7.  
  8.  
  9.  
  10.  
  11. /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
  12.  *                                                                    *
  13.  *        HOW TO BUILD YOUR OWN DISK-RESIDENT SHARED LIBRARY          *
  14.  *                     - WORKING  EXAMPLE -                           *
  15.  *                                                                    *
  16.  *        by Jean-Michel FORGEAS                                      *
  17.  *        February 1988                                               *
  18.  *                                                                    *
  19.  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
  20.  
  21.  
  22.     Here is a WORKING example for LATTICE(TM) C compiler of how to CREATE
  23. and to use your own disk-resident libraries  (such as translator.library,
  24. icon.library, diskfont.library etc.. supplied by Commodore
  25. in LIBS: directory on the Workbench disk).
  26.  
  27.  
  28.                         ----------------
  29.  
  30. These files were compiled with Lattice C 4.0 and assembled with
  31.             MCC Macro Assembler.
  32.  
  33.                         ----------------
  34.  
  35.  
  36.  
  37.   HOW TO BUILD A LIBRARY OF C FUNCTIONS SHARED BY SEVERAL PROGRAMS AND
  38.                  MANAGED BY AMIGADOS AND EXEC ?
  39.  
  40.  
  41.   1) take the following files in RKM vol2, Appendix K:
  42.  
  43.         - asmsupp.i   (Commodore support)  ->  execlib/i_asmsupp.i
  44.         - mylib.i     (skeleton declar. )  ->  execlib/i_flamlib.i
  45.         - mylib.asm   (skeleton library )  ->  execlib/libskel.asm
  46.  
  47.  
  48.   2) declare your new functions in:
  49.  
  50.         - i_flamlib.i
  51.         - libskel.asm
  52.         - libfuncs.c  (your C functions must be written in reentrant manner)
  53.  
  54.  
  55.   3) under the CLI do:
  56.  
  57.         assign LIB: <directory where amiga.lib and AStartup.obj are>
  58.         assign I: <directory of C includes>
  59.         cd execlib
  60.  
  61.         assem libskel.asm -i <dir of .i> -o libskel.obj
  62.                    (--> libskel.obj  716 bytes on disk)
  63.  
  64.         lc1 -iI: -b0 -ccs libfuncs
  65.         lc2 -r -v -s libfuncs
  66.                     (--> libfuncs.o   144 bytes on disk)
  67.  
  68.         execute ex_makelib
  69.                      (--> flam.library 516 bytes on disk)
  70.  
  71.    and that's it. The library should be now in LIBS: directory.
  72.  
  73.  
  74.                            -------------------
  75.  
  76.  
  77.    HOW TO USE THIS LIBRARY WITH YOUR C PROGRAMS ?
  78.  
  79.    1) create a test program that opens, uses and closes the library.
  80.  
  81.         - test.c
  82.  
  83.         NOTE: if you want the library to stay in memory after
  84.               your program exit(), just suppress the call to RemLibrary().
  85.  
  86.    2) create a .lib such as amiga.lib to link your programs with:
  87.  
  88.         - flam.lib.asm
  89.  
  90.  
  91.    3) under the CLI:
  92.  
  93.         lc1 -iI: -b0 -ccs test
  94.         lc2 -r -v -s test
  95.                      (--> test.o   632 bytes on disk)
  96.  
  97.         assem flam.lib.asm -i <dir of .i>  -o flam.lib
  98.                      (--> flam.lib 136 bytes on disk)
  99.  
  100.         blink LIB:AStartup.obj test.o TO test LIB flam.lib LIB:amiga.lib
  101.                      (--> test    2220 bytes on disk)
  102.  
  103.  
  104.                            -------------------
  105.  
  106.  
  107.    NOTE:
  108.         In this example, DOSBase and SysBase are not declared in libskel.asm,
  109.         so if you want to call DOS or Exec functions - add
  110.         the definitions _DOSBase and _SysBase in libskel.asm :
  111.  
  112.             _DOSBase  DS.L 1
  113.             _SysBase  DS.L 1
  114.  
  115.         Don't forget to declare them in XDEF and to initialize them -
  116.         look on initRoutine in libskel.asm.
  117.  
  118.  
  119.         Enjoy !
  120.  
  121.  
  122.                            -------------------
  123.                             ___       _
  124.                            /__  /    /_|   /|/|
  125.                           /    /__  /  |  /   |
  126.  
  127.  
  128.  
  129. CONTACT:
  130. -------
  131.             J-M.Forgeas,
  132.             21 rue Voltaire,
  133.             92300 Levallois-Perret,
  134.             FRANCE
  135.  
  136.  
  137.